﻿Imports Alquilaqi


Public Class WebForm2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnIngresar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnIngresar.Click
        Try
            Dim negocio As New UsuarioNegocio
            Dim modelo = negocio.validar(Me.txtUsuario.Text, Me.txtClave.Text)

            Dim listaRoles = modelo.roles

            Dim url As String = ""

            For Each x As Rol In listaRoles

                ' Si es Cliente
                If Constantes.ROL_CLIENTE = x.rolNombre Then
                    url = "~/ClienteMenu.aspx"
                End If

                ' Si es Dueno
                If Constantes.ROL_DUENO = x.rolNombre Then
                    url = "~/DuenoMenu.aspx"
                End If

            Next

            Response.Redirect(url, False)

        Catch ex As Exception
            Response.Write(ex.Message)
        End Try

    End Sub
End Class